<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('表格模板一')" />
    <th:block th:include="include :: datetimepicker-css" />
    <style>
        #bootstrap-table tr th,td {
            width: 100px; /* 设置最小宽度 */
            overflow: hidden; /* 超出最小宽度的内容会被隐藏 */
            text-overflow: ellipsis; /* 超出部分显示省略号 */
            white-space: nowrap; /* 不换行 */
        }
    </style>
</head>
<body class="gray-bg" th:attr="func-name=${reportParam.na}">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <input type="hidden" id="param" th:value="${reportParam.param}">
                <input type="hidden" id="euDateType" th:value="${reportParam.euDateType}">
                <div class="select-list">
                    <ul id="paramUl">
                        <li th:if="${reportParam.euDateCls<2}">
                            <label>开始：</label>
                            <input id="startDay" autocomplete="off"  placeholder="yyyy-MM" type="text" required th:value="${dayBegin}">
                        </li>
                        <li th:if="${reportParam.euDateCls==1}">
                            <label>结束：</label>
                            <input id="endDay" autocomplete="off"  placeholder="yyyy-MM" type="text" required th:value="${dayEnd}">
                        </li>
                        <li name="other" th:each="filter:${reportParam.filterList}">
                            <label th:text="${filter.na}+'：'"></label>
                            <input type="text" id="" th:attr="name=${filter.cd}"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="searchData()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-danger btn-rounded btn-sm" onclick="dowloadData()"><i class="fa fa-download"></i>&nbsp;导出</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table" class="table table-bordered"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-export-js" />
<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
<script th:src="@{/ruoyi/js/table-data.js}"></script>
<script th:inline="javascript">
    var initParam = function() {
        var param = JSON.parse($("#param").val());
        param.fileName=$("body").attr("func-name");
        var fieldFlds = $("#paramUl").find("li[name='other'] input");
        var dims = param.dimVOList;
        $.each(fieldFlds,function (index,item) {
             var name = $(item).attr("name");
             var val = $(item).val();
            $.each(dims,function (i,t) {
                if(t.idPubfld==name) {
                    if(val!='') {
                        t.filter="NA_DIM_ORG like '%"+val+"%'";
                    } else {
                        t.filter="";
                    }
                }
            });
        });
        return param;
    }, dowloadData = function() {
        tableDataExport(initParam());
    }, searchData = function () {
        dwTableDataInit(initParam());
    };
    $(function () {

        var euDateType = $("#euDateType").val();
        if(euDateType=="D") {
            $("#startDay").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
            $("#endDay").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
        } else if(euDateType=="M"){
            $("#startDay").datetimepicker({
                format: "yyyy-mm",
                startView: 3,
                minView: 3,
                maxDate: now.getFullYear() + "-" + (now.getMonth()),
                autoclose: true
            });
            $("#endDay").datetimepicker({
                format: "yyyy-mm",
                startView: 3,
                minView: 3,
                maxDate: now.getFullYear() + "-" + (now.getMonth()),
                autoclose: true
            });
        }
        dwTableDataInit(initParam());
        setScroll();
    });
    function setScroll(){
        debugger;
        var height=parseInt($(window).height()-100)+"px";
        $(".bottomScroll").css({"height":height,
            'overflow-y': 'scroll',
            'overflow-x': 'scroll',
            'display': 'inline-grid'});
    }
</script>
</body>
</html>